1. Technical Field
The present invention relates generally to file system maintenance in a computer and more particularly to a technique for priming or refreshing directory limits in a file system.
2. Brief Description of the Related Art
Computer systems typically include mass storage devices configured as a xe2x80x9cfile system.xe2x80x9d Mass storage devices include hard drives, optical disk drives, magnetic tape drives, solid state disk drives and bubble memories. Software routines for maintaining such a file system are known in the art as xe2x80x9ccheck and repairxe2x80x9d utilities. For example, in the UNIX Operating System, a utility called xe2x80x9cfsckxe2x80x9d is used to verify control information and the directories of the file system after an unscheduled event such as a power outage. The xe2x80x9cfsckxe2x80x9d command bypasses standard file access methods and compares directory and control information in an effort to identify any disk blocks or control structures (known as inodes) that are not accounted for within the file system. Errors in the state of the file system are then addressed in an attempt to return the system to a known correct state. A similar routine, called xe2x80x9cchkdskxe2x80x9d is used in DOS-based systems.
A local area network (LAN) system administrator typically imposes so-called xe2x80x9cdirectory limitsxe2x80x9d on a file system. A directory limit is the maximum amount of space on the file system that can be allocated to the subdirectories and files of a given directory. Although directory limits are a LAN function, file system support is required to implement them. When directory (e.g., DASD) limits are enabled on a file system volume, it is necessary to xe2x80x9cprimexe2x80x9d the file system on the volume by initializing the limit on each directory to zero and by calculating a current xe2x80x9cDASD Usedxe2x80x9d value for each directory. In addition, the system administrator may request that DASD Used data be refreshed at any time, and this also requires the calculation of current DASD Used for each directory.
In the case or initialization or priming, the calculation of DASD Used is a time-consuming, input-output intensive process. It involves recursively summing the file system storage used by each file or subdirectory in each directory on the volume. In particular, it is necessary to store, in the structure for each directory, the sum of the storage allocated for each file in that directory. It is then necessary to add, from the bottom up, the sum stored for each directory to the sum stored for the directory which contains it, until the root directory contains the sum of all storage allocated to any file or directory on the volume. This processing requires the structure representing each file to be read at least once and the structure representing each directory to be read and written at least once.
In the prior art, the directory limits calculations are performed during the volume mount initiated when the request is received. However, if the file system residing on the volume was not properly shut down, or if some corruption has been detected by the file system, then it is also necessary to check and repair the file system before the volume can be mounted. A full check and repair, however, is itself a time-consuming, I/O intensive process that consumes processing time but which is unavoidable for a file system in the situations described.
It would be desirable to streamline the priming or refreshing of directory limits in a file system.
The present invention addresses the deficiencies of the prior art by enabling the initialization or refresh of the file system directory limits in parallel to the check and repair operation during a file system mount.
According to the present invention, when the check and repair utility performs full check and repair processing on a file system a determination is made regarding whether directory limits are currently enabled for the volume and whether there is an outstanding request to either prime or refresh directory limits for the volume. If there is an outstanding request, it is satisfied in parallel with the check and repair processing. If there is no outstanding request but directory limits are currently enabled for the volume, then processing is done as though there had been an outstanding request to refresh directory limits for the volume.
If no volume check and repair is necessary, then mount processing primes or refreshes directory limits for the volume in the usual manner.
Preferably, the check and repair routine calculates the storage used by each directory subtree as follows. First, when the check and repair utility verifies the amount of storage allocated to each file and directory in the file system, the utility notes, in dynamic storage, the amount of storage allocated. Then, the storage for each valid file is added to the sum for the directory that contains the file. The check and repair utility then verifies the validity of the directory tree. During verification, the utility determines and notes the distance from each directory""s level in the tree to the root of the directory. The utility then adds, from highest level number to lowest, the sum of storage allocated to each directory to the sum for the directory that contains it.
When the structure for each directory is read (e.g., to verify its back pointer), the check and repair utility stores the sum it has calculated for the structure as DASD Used and stores zero as the Directory Limit (for the directory) if the requested service is xe2x80x9cprime.xe2x80x9d After any other check and repair processing needed for the directory, the structure is written to the volume.
If refresh processing is being performed, the utility determines whether DASD Used currently stored in the structure matches the sum that the utility has calculated for it when the structure for each directory is read. If these values do not match, the check and repair utility replaces the current value with the sum calculated and forces a write to the volume.
The foregoing has outlined some of the more pertinent objects and features of the present invention. These objects should be construed to be merely illustrative of some of the more prominent features and applications of the invention. Many other beneficial results can be attained by applying the disclosed invention in a different manner or modifying the invention as will be described. Accordingly, other objects and a fuller understanding of the invention may be had by referring to the following Detailed Description of the Preferred Embodiment.